﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GmepDataSetInterface.h"
#include <ParameterStorageType.h>
#include <IParameterValueStorage.h>


#include <string>
#include <vector>
#include <map>

namespace gmep
{

    // gac里 "管件零件类型" 属性的名称 
    #define PARTTYPE_PARAM_NAME_INGAC L"零件类型"

    // 构件概况
    class GMEP_DATASET_INTERFACE_EXPORT GmepProjectSettingComponentGeneral
    {
      public:
        //std::wstring m_categoryId;
        //std::wstring m_categoryStandardCode;
        //std::wstring m_categoryName;
        std::wstring m_categoryMappedId;

        std::wstring m_id;
        //Int64 m_longId;
        Int64 m_publicCompId;
        std::wstring m_name;
        //std::wstring m_desc;
        std::wstring m_familyPicture; // 3d png path
        //std::wstring m_2DFamilyPicture; // 二维图例主图的png路径
        std::wstring m_familyFilePath; // 3d .gac

        int m_DirtyFlag; //构建状态
        //std::wstring m_family2DFilePath; // 平面 .gac
        //std::wstring m_family2DFrontFilePath; // 左右立面 .gac
        //std::wstring m_family2DLeftFilePath; // 前后立面 .gac
        int m_version;
        Int64 m_timeStamp;
    };
    // 普通构件
    class GMEP_DATASET_INTERFACE_EXPORT IGmepProjectSettingComponentParameterValue
    {
    public:
        static gcmp::OwnerPtr<IGmepProjectSettingComponentParameterValue> Create();
        virtual gcmp::OwnerPtr<IGmepProjectSettingComponentParameterValue> Clone()=0;

        virtual const std::wstring GetPropertyId() const = 0;
        virtual void SetPropertyId(std::wstring strId) = 0;

        virtual const std::wstring GetPropertyStandardCode() const = 0;
        virtual void SetPropertyStandardCode(std::wstring strCode) = 0;
        virtual const std::wstring GetPropertyName() const = 0;
        virtual void SetPropertyName(std::wstring strName) = 0;

        virtual const std::wstring GetUnitString() const= 0;
        virtual void SetUnitString(std::wstring strUnit) = 0;
        virtual const bool IsInUse() const = 0;
        virtual void SetIsInUse(bool isInUse) = 0;

        virtual const std::wstring GetUnitCode() const = 0;
        virtual void SetUnitCode(std::wstring strUnitCode) = 0;

        virtual const gcmp::IParameterValueStorage* GetValue() const = 0;
        virtual gcmp::IParameterValueStorage* GetValueFW() = 0;
        virtual void SetValue(gcmp::OwnerPtr<gcmp::IParameterValueStorage> value) = 0;

    };

    class GMEP_DATASET_INTERFACE_EXPORT IGmepProjectSettingComponentType
    {
    public:

        static gcmp::OwnerPtr<IGmepProjectSettingComponentType> Create();

        virtual  gcmp::OwnerPtr<IGmepProjectSettingComponentType> Clone()= 0;

        virtual const std::wstring GetTypeName() const = 0;
        virtual void SetTypeName(std::wstring name) = 0;

        virtual const std::wstring GetTypeId() const = 0;
        virtual void SetTypeId(std::wstring name) = 0;

        virtual const std::wstring GetFamilyParamString() const = 0;
        virtual void SetFamilyParamString(std::wstring paramStr) = 0;

        virtual const std::wstring GetFamilyParamUnDriveString() const = 0;
        virtual void SetFamilyParamUnDriveString(std::wstring paramStr) = 0;

        virtual void AddValue(gcmp::OwnerPtr<IGmepProjectSettingComponentParameterValue > newValue) = 0;
        virtual void ClearValueList() = 0;
        virtual std::map <std::wstring, const IGmepProjectSettingComponentParameterValue*> GetValueList() const = 0;
        virtual std::map <std::wstring, IGmepProjectSettingComponentParameterValue*> GetValueListFW() = 0;

    };

    class GMEP_DATASET_INTERFACE_EXPORT IGmepProjectSettingComponent
    {
    public:
        static gcmp::OwnerPtr<IGmepProjectSettingComponent> Create();

        virtual gcmp::OwnerPtr<IGmepProjectSettingComponent> Clone() = 0;

        virtual const std::wstring GetId() const = 0;
        virtual void SetId(std::wstring strId) = 0;

        virtual const Int64 GetLongId() const = 0;
        virtual void SetLongId(Int64 longId) = 0;

        virtual const Int64 GetPublicCompId() const = 0;
        virtual void SetPublicCompId(Int64 longId) = 0;

        virtual const std::wstring GetPublicSourceVersion() const = 0;
        virtual void SetPublicSourceVersion(const std::wstring& srcVersion) = 0;

        virtual const std::wstring GetCategoryId() const = 0;
        virtual void SetCategoryId(std::wstring categoryId) = 0;

        virtual const std::wstring GetCategoryStandardCode() const = 0;
        virtual void SetCategoryStandardCode(std::wstring categoryCode) = 0;

        virtual const std::wstring GetCategoryName() const = 0;
        virtual void SetCategoryName(std::wstring name) = 0;

        virtual const std::wstring GetCategorMappedId() const = 0;
        virtual void SetCategorMappedId(std::wstring name) = 0;

        virtual const std::wstring GetName() const= 0;
        virtual void SetName(std::wstring strName) = 0;

        virtual const std::wstring GetDescription() const  = 0;
        virtual void SetDescription(std::wstring strDesc) = 0;

        virtual std::wstring GetFamilyPicturePath()  const = 0;
        virtual void SetFamilyPicturePath(std::wstring filePath) = 0;
        virtual std::wstring Get2DFamilyPicturePath() const = 0;
        virtual void Set2DFamilyPicturePath(std::wstring filePath) = 0;

        virtual std::wstring GetFamilyFilePath() const = 0;
        virtual void SetFamilyFilePath(std::wstring familyPath) = 0;

        virtual Int64 GetTimeStamp() const = 0;
        virtual void SetTimeStamp(Int64 timeStamp) = 0;

        virtual std::wstring GetGeometryParameterDefinition() const = 0;
        virtual void SetGeometryParameterDefinition(std::wstring& geoParamDef) = 0;

        // 平面图例
        virtual std::wstring Get2DFamilyFilePath()  const = 0;
        virtual void Set2DFamilyFilePath(std::wstring familyPath) = 0;
        virtual std::wstring Get2DFamilyId() const = 0;
        virtual void Set2DFamilyId(std::wstring familyId) = 0;
        virtual int Get2DFamilyFrom() const = 0;
        virtual void Set2DFamilyFrom(int placeholderFrom) = 0;

        // 前后图例
        virtual std::wstring Get2DFamilyFrontFilePath()  const = 0;
        virtual void Set2DFamilyFrontFilePath(std::wstring familyPath) = 0;
        virtual std::wstring Get2DFamilyFrontId() const = 0;
        virtual void Set2DFamilyFrontId(std::wstring familyId) = 0;
        virtual int Get2DFamilyFrontFrom() const = 0;
        virtual void Set2DFamilyFrontFrom(int placeholderFrom) = 0;

        // 左右图例
        virtual std::wstring Get2DFamilyLeftFilePath() const = 0;
        virtual void Set2DFamilyLeftFilePath(std::wstring familyPath) = 0;
        virtual std::wstring Get2DFamilyLeftId() const = 0;
        virtual void Set2DFamilyLeftId(std::wstring familyId) = 0;
        virtual int Get2DFamilyLeftFrom() const = 0;
        virtual void Set2DFamilyLeftFrom(int placeholderFrom) = 0;

        // 电气图例
        virtual std::wstring Get2DFamilyElectricFilePath() const = 0;
        virtual void Set2DFamilyElectricFilePath(std::wstring familyPath) = 0;
        virtual std::wstring Get2DFamilyElectricId() const = 0;
        virtual void Set2DFamilyElectricId(std::wstring familyId) = 0;
        virtual int Get2DFamilyElectricFrom() const = 0;
        virtual void Set2DFamilyElectricFrom(int placeholderFrom) = 0;

        virtual int GetVersion() const = 0;
        virtual void SetVersion(int iVer) = 0;

        virtual int GetDirtyFlag() const = 0;
        virtual void SetDirtyFlag(int iVer) = 0;

        virtual void AddType(gcmp::OwnerPtr<gmep::IGmepProjectSettingComponentType> newType) = 0;
        virtual void ClearPropertyList() = 0;
        virtual const std::vector<const gmep::IGmepProjectSettingComponentType*> GetTypeList() const = 0;
        virtual std::vector<gmep::IGmepProjectSettingComponentType*> GetTypeListFW() = 0;
    };

    // 组合式构件
    struct GmepCombinedProductItem
    {
        GmepCombinedProductItem()
        {
            CategoryStandardCode = L"";
            CategoryUid = L"";
            MappedId = L"";
            ComponentId = L"";
            ComponentTypeId = L"";
        }
        GmepCombinedProductItem(std::wstring stdCode, std::wstring categoryuid, std::wstring mapId, std::wstring compId, std::wstring typeId)
        {
            CategoryStandardCode = stdCode;
            CategoryUid = categoryuid;
            MappedId = mapId;
            ComponentId = compId;
            ComponentTypeId = typeId;
        }
        std::wstring CategoryStandardCode;
        std::wstring CategoryUid;
        std::wstring MappedId;

        std::wstring ComponentId;
        std::wstring ComponentTypeId;
    };

    struct GmepCombinedProduct
    {
        GmepCombinedProduct()
        {
            CategoryStandardCode = L"";
            CategoryUid = L"";
            MappedId = L"";
            Id = L"";
            Name = L"";
            Spacing = 0;
            Items.clear();
            SupplySystemTypeId = L"";
            SupplyDuctTypeId = L"";

            SupplyHoseLength = 0.0;
            SupplyAirTerminalNumber = 1;
            SupplyAirTerminalDist1 = 0.0;
            SupplyAirTerminalDist2 = 0.0;

            ReturnSystemTypeId = L"";
            ReturnDuctTypeId = L"";
            ReturnHoseLength = 0.0;
        }
        GmepCombinedProduct(std::wstring stdCode, std::wstring cateGUID, std::wstring mappedId, 
            std::wstring id, std::wstring name)
        {

            CategoryStandardCode = stdCode;
            CategoryUid = cateGUID;
            MappedId = mappedId;
            Id = id;
            Name = name;

            Spacing = 0;
            SupplyHoseLength = 0.0;
            SupplyAirTerminalNumber = 1;
            SupplyAirTerminalDist1 = 0.0;
            SupplyAirTerminalDist2 = 0.0;

            ReturnHoseLength = 0.0;
        }
        std::wstring CategoryStandardCode;
        std::wstring CategoryUid;
        std::wstring MappedId;

        std::wstring Id;// 组合式构件的guid
        std::wstring Name;

        // 阀组
        int Spacing;
        std::vector<GmepCombinedProductItem> Items;

        //fancoil、VRV
        GmepCombinedProductItem mainEquipmentItem;
        GmepCombinedProductItem SupplyAirTerminalItem;
        GmepCombinedProductItem ReturnAirTerminalItem;

        std::wstring SupplySystemTypeId;
        std::wstring SupplyDuctTypeId;
        double SupplyHoseLength;
        int SupplyAirTerminalNumber;
        double SupplyAirTerminalDist1;
        double SupplyAirTerminalDist2;

        std::wstring ReturnSystemTypeId;
        std::wstring ReturnDuctTypeId;
        double ReturnHoseLength;
        
    };
}